package com.fortune.service.impl;

import com.fortune.dao.MTerminalDiscountMgtDao;
import com.fortune.dto.in.mTerminalDiscount.TerminalDiscountAddDto;
import com.fortune.dto.in.mTerminalDiscount.TerminalDiscountEditDto;
import com.fortune.dto.in.mTerminalDiscount.TerminalDiscountListDto;
import com.fortune.service.MTerminalDiscountService;
import com.fortune.vo.terminalDiscount.MTerminalDiscount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MTerminalDiscountServiceImpl implements MTerminalDiscountService {
    @Autowired
    private MTerminalDiscountMgtDao mTerminalDiscountMgtDao;

    /**
     * 优惠政策列表
     * @param companyId
     * @param terminalDiscountListDto
     * @return
     */
    @Override
    public List<MTerminalDiscount> queryTerminalDiscountList(String companyId, TerminalDiscountListDto terminalDiscountListDto) {
        return mTerminalDiscountMgtDao.queryTerminalDiscountList(companyId,terminalDiscountListDto);
    }

    /**
     * 优惠政策列表个数
     * @param companyId
     * @param terminalDiscountListDto
     * @return
     */
    @Override
    public int queryTerminalDiscountListCount(String companyId, TerminalDiscountListDto terminalDiscountListDto) {
        return mTerminalDiscountMgtDao.queryTerminalDiscountListCount(companyId,terminalDiscountListDto);
    }

    /**
     * 查询优惠政策是否存在
     * @param companyId
     * @param name
     * @return
     */
    @Override
    public int queryTerminalDiscountCountByName(String companyId, String name) {
        return mTerminalDiscountMgtDao.queryTerminalDiscountCountByName(companyId,name);
    }

    /**
     * 添加优惠政策
     * @param companyId
     * @param addDto
     * @return
     */
    @Override
    public int addTerminalDiscountCount(String companyId, TerminalDiscountAddDto addDto) {
        return mTerminalDiscountMgtDao.addTerminalDiscountCount(companyId,addDto);
    }

    /**
     * 删除优惠政策
     * @param companyId
     * @param id
     * @return
     */
    @Override
    public int deleteTerminalDiscountCount(String companyId, String id) {
        return mTerminalDiscountMgtDao.deleteTerminalDiscountCount(companyId,id);
    }

    /**
     * 编辑时查询是否存在
     * @param companyId
     * @param name
     * @param id
     * @return
     */
    @Override
    public int queryIsExist(String companyId, String name, String id) {
        return mTerminalDiscountMgtDao.queryIsExist(companyId,name,id);
    }

    /**
     * 编辑优惠政策
     * @param companyId
     * @param editDto
     * @return
     */
    @Override
    public int editTerminalDiscountCount(String companyId, TerminalDiscountEditDto editDto) {
        return mTerminalDiscountMgtDao.editTerminalDiscountCount(companyId,editDto);
    }
}
